Repository navigation
The Rust SDK retries pre-dispatch refusals and classifies errors - #1684
Conversation
Pace rate-limit responses within the wait budget and allow configured status retries when the operation did not run. Resolve typed error hints without removing the raw response fields. Signed-off-by: zhangxiaoyu.york <zhangxiaoyu.york@bytedance.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 19d499a. Configure here.
zlareb1
left a comment
There was a problem hiding this comment.
A raw 503 on a route write still yields retryable() == true. request and request_json return the parsed error directly, so an upload caller following the hint can repeat a write after the route commits. Apply the same ambiguity handling to route writes and cover a 503 without a retry flag in the route tests. Existing thread
Update the Client::call method docs as well. They promise that unknown operations retry only before connection, but the new 429 and pre-dispatch status paths also resend those operations.
A route can commit a write before a 5xx response arrives. Reuse the operation error classification so an undeclared retry hint does not invite a duplicate write. Document when unknown operations can be resent. Signed-off-by: zhangxiaoyu.york <zhangxiaoyu.york@bytedance.com>
zlareb1
left a comment
There was a problem hiding this comment.
The route request path clears the retry hint for an ambiguous 5xx after a write and preserves it for reads. The new regression covers both cases. The operation docs describe the retry and pacing paths.

Part of #52
Changelog category
Changelog entry
The Rust SDK paces rate-limited operations within the configured wait budget and retries eligible responses that indicate the operation did not run. It adds typed error categories, retry hints, and accessors for precondition and wrong-cell details while preserving the raw response fields.
Why
A request refused before execution can be sent again without duplicating a write. When a request may have executed, the client still needs the operation's idempotency policy. Callers can use typed errors to decide how to recover without parsing error messages.
Scope and risk
429even when the operation is not idempotent. Operation and direct route calls return the original429when the wait exceeds the remaining pacing budget.408andAUTH_UNAVAILABLEcan be retried on non-idempotent operations under the configured status policy. Other HTTP failures and ambiguous transport failures still do not trigger automatic resends for non-idempotent operations.ErrorKind,ErrorCategory, and typed accessors forcurrent_sha256,org, andcell.retryable()provides an error hint; automatic resends still follow the client policy.Compatibility, rollout and rollback
Tests
blocking; Clippy passed for the library and client tests.Retry-After: 3600returns429after one request with the default budget. Client tests also check send counts for408,AUTH_UNAVAILABLE, and ordinary503.make format lint typecheckand the documentation checks passed locally.AI assistance in the code
Checklist
Note
Medium Risk
Client retry/idempotency semantics changed for 429, 408, AUTH_UNAVAILABLE, and ambiguous 5xx on writes—callers may see different automatic resends and
retryable()hints without server wire changes.Overview
The Rust SDK gains typed API errors (
ErrorKind,ErrorCategory) and resolver methods onError/ApiError—kind(),category(),retryable()—plus accessors for precondition (current_sha256) and wrong-cell (org,cell) details while keeping raw response fields. These are exported fromlib.rsand documented in the README (with a note that published0.1.1still exposes raw fields).Retry and pacing behavior changes: HTTP 429 is paced on every operation (not only idempotent ones). Pacing waits for the server hint only when it fits the remaining sleep budget; hints over budget or zero wait return 429 without resending (no separate 5s cap per round). After dispatch, status retries still require idempotence except when the response proves the handler did not run (408,
AUTH_UNAVAILABLE). On final failure,mark_maybe_appliedmarks ambiguous 5xx on non-idempotent calls (and unsafe route methods) as non-retryable when the body did not declare retryability.Integration tests (
retry_scope, client, routes, blocking) lock in the new pacing, retry eligibility, and typed error surfaces.Reviewed by Cursor Bugbot for commit 9084a70. Bugbot is set up for automated code reviews on this repo. Configure here.